const rp = require('request-promise')

const API = {
  terms(id) {
    return rp({
      method: 'GET',
      uri: `https://api.testing.hetao101.com/shop/v1/activities/${id}/terms`,
      json: true
    })
    .then(data => {
      return data.data
    })
    .catch(err => {return err})
  },
  course(id) {
    return rp({
      method: 'GET',
      uri: `https://api.testing.hetao101.com/shop/v1/activities/${id}/course_sets`,
      json: true
    })
    .then(data => {
      return data.data
    })
    .catch(err => {return err})
  }
}

module.exports = API